import { REG_NAME } from "../common";
import { UserApp } from "../interface";

export const validteUserApp = (app: UserApp, apps: UserApp[]) => {
    if (!app.title) {
        return "站点标题不能为空"
    }
    if (!REG_NAME.test(app.title)) {
        return "站点标题不能包含特殊字符"
    }
    if (apps && apps.find(item => item.id != app.id && item.title === app.title)) {
        return "站点已存在"
    }
}